<template>
  <div class="views-container">
    <el-dialog :visible.sync="dialogVisibleStock" width="30%" custom-class="reset-pwd wlm-form-dialog dialog-table">
      <el-scrollbar wrap-class="scrollbar-wrapper">
        <div class="wlm-form-content wlm-table">

          <div class="wlm-dialog-main wlm-table-content" style="padding:16px 0 0;">

            <el-form :model="formFormatData.formData" size="small" class="retail-form">
              <el-form-item>
                <el-input v-model="formFormatData.formData.supplier" placeholder="请输入供应商" style="width:200px;"></el-input>
              </el-form-item>
              <el-form-item label="" class="filter-btns">
                <el-button v-waves type="primary" @click="formFormatEditEvt">筛选</el-button>
                <el-button type="text" @click="formFormatEditEvt">清空筛选条件</el-button>
              </el-form-item>
            </el-form>

            <div class="wlm-dialog-content">
              <el-table :data="formFormatData.formData.data" style="width: 100%">
                <el-table-column type="selection" width="55"></el-table-column>
                <el-table-column label="供应商" prop="suppiler">
                </el-table-column>
                <el-table-column label="状态" prop="status">
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </el-scrollbar>
    </el-dialog>
    <div class="wlm-table">
      <div class="wlm-table-header">
        <el-form :model="tableFormatData.stockList.files" size="small" label-width="100px" class="retail-form" label-position="right">
          <el-form-item label="日期：">
            <el-date-picker v-model="tableFormatData.stockList.files.time" type="daterange" value-format="timestamp" :default-time="['00:00:00', '23:59:59']"  range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="" class="filter-btns">
            <el-button  type="primary" @click="filesSerch">筛选</el-button>
            <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="wlm-table-content">
        <el-table :ref="tableFormatData.stockList.key" :data="tableFormatData.stockList.tableData" @selection-change="handleSelectionChange" style="width: 100%">
          <!-- <el-table-column type="selection" width="55">
                </el-table-column> -->

          <el-table-column prop="stockTime" label="备货日期">
            <template slot-scope="scope">
                <span style="font-weight: bold;">{{scope.row.stockTime}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="order_num" label="总订单数">
          </el-table-column>
          <el-table-column prop="goods_num" label="总商品数">
          </el-table-column>
          <el-table-column prop="pay_price" label="总实付金额">
          </el-table-column>
          <el-table-column prop="reg_money" label="团长佣金">
          </el-table-column>
          <el-table-column prop="platform_money" label="平台分成">
          </el-table-column>
          <el-table-column prop="supplier_money" label="供应商应得">
          </el-table-column>
          <el-table-column prop="is_yes" label="是否确认备货">
            <template slot-scope="scope">
              <el-tag type="success" v-if="scope.row.is_yes ==1">已全部备货</el-tag>
              <el-tag type="danger" v-if="scope.row.is_yes ==2">未完全备货</el-tag>
              <!-- {{scope.row.is_yes ==1?'已全部备货':'未完全备货'}} -->
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <div class="operation-group">
                <router-link class="wlm-text" tag="span" :to="{path:'/application/stockDetail', query:{stockTime:scope.row.stockTime}}">
                  <el-button type="text">详情</el-button>
                </router-link>
                <!-- <div class="btn-line"></div>
                <el-button class="wlm-text" type="text" @click="formFormatDialogEditEvt({stockTime:scope.row.createTime, toggle:'dialogVisibleStock'})">确认备货</el-button> -->
              </div>
            </template>

          </el-table-column>
        </el-table>
        <div class="pagination-content flex-row flex-justify-e flex-align-c">
          <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.stockList.pagination.page" :page-sizes="tableFormatData.stockList.pagination.pagesizes" :page-size.sync="tableFormatData.stockList.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.stockList.pagination.total : 0">
          </el-pagination>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
import { stock } from '@/api/commityBuy'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Form'), mixins.getters('Table')],
  data() {
    return {
      dialogVisibleStock: false,
      tableFormatData: {
        current: 'stockList',
        stockList: {
          key: 'stockList',
          api: {
            getList: stock,
            delList: ''

          },
          tableData: [{
            orderNumber: 1
          }],
          files: {
            time: [],
            ids: [],
            checkall: '0'
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }

      },
      formFormatData: {
        key: 'userForm',
        model: {
          noCreateEdit: false,
          bindDialog: 'dialogVisibleStock'
        },
        api: {
          editForm: {
            api: 1,
            params: {
              stockTime: '',
              name: ''
            },
            redirect: 'ids'
          }
        },
        formData: {
          data: []
        },
        rules: {}
      }
    }
  },
  methods: {
  }

}
</script>

<style>
</style>
